home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Internet / TurboTCP 2.1 ƒ / PP helper classes / CTCPSessionDocPP.cp < prev    next >
Encoding:
Text File  |  1995-01-18  |  2.0 KB  |  98 lines  |  [TEXT/MMCC]

  1. //
  2. // CTCPSessionDocPP.cp
  3. //
  4. //    TurboTCP library
  5. //    TCP session document
  6. //    PowerPlant-specific class
  7. //
  8. //    Copyright © 1993-95, FrostByte Design / Eric Scouten
  9. //
  10.  
  11. #include "CTCPSessionDocPP.h"
  12.  
  13. #if !TurboTCP_PP
  14.     #error: This file should be used with PowerPlant projects only!
  15. #endif
  16.  
  17. #include <LWindow.h>
  18.  
  19.  
  20. //***********************************************************
  21.  
  22. CTCPSessionDocPP::CTCPSessionDocPP
  23.     (LCommander*    inSuper,
  24.     unsigned short    theDefaultPort,
  25.     unsigned long    recBufferSize,
  26.     unsigned short    autoReceiveSize,
  27.     unsigned short    autoReceiveNum,
  28.     Boolean        doUseCName)
  29.  
  30. : LSingleDoc(inSuper),
  31.   CTCPEndpoint(theDefaultPort, recBufferSize, autoReceiveSize, autoReceiveNum, doUseCName)
  32.  
  33. { }
  34.  
  35.  
  36. //***********************************************************
  37.  
  38. CTCPSessionDocPP::CTCPSessionDocPP
  39.     (unsigned short    theDefaultPort,
  40.     unsigned long    recBufferSize,
  41.     unsigned short    autoReceiveSize,
  42.     unsigned short    autoReceiveNum,
  43.     Boolean        doUseCName)
  44.  
  45. : CTCPEndpoint(theDefaultPort, recBufferSize, autoReceiveSize, autoReceiveNum, doUseCName)
  46. { }
  47.  
  48.  
  49. // -- closing windows & sessions --
  50.  
  51. //***********************************************************
  52.  
  53. void CTCPSessionDocPP::AttemptClose
  54.     (Boolean inRecordIt)
  55.  
  56. {
  57.     if (LocalClose(false))
  58.         LDocument::AttemptClose(inRecordIt);
  59. }
  60.  
  61.  
  62. //***********************************************************
  63.  
  64. void CTCPSessionDocPP::RemoteClose()
  65.  
  66.     // Respond to notification that the remote host cancelled the session (either by normal
  67.     // close or terminate).
  68.  
  69. {
  70.     Boolean sessionWasEstablished = SessionEstablished();
  71.  
  72.     CTCPEndpoint::RemoteClose();
  73.     if ((goAwayOnClose) && (!sessionWasEstablished))
  74.         LDocument::Close();
  75. }
  76.  
  77.  
  78. // –– window titling --
  79.  
  80. //***********************************************************
  81.  
  82. void CTCPSessionDocPP::GetFileName
  83.     (Str255 theName)                        // returns the name of the file or window
  84.  
  85. {
  86.     GetDescriptor(theName);
  87. }
  88.  
  89. //***********************************************************
  90.  
  91. void CTCPSessionDocPP::SetWindowTitle
  92.     (Str255 newTitle)                            // new window title
  93.  
  94. {
  95.     if (mWindow)
  96.         mWindow->SetDescriptor(newTitle);
  97. }
  98.